﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Enumerations
{
    public partial class frmEnumerations : Form
    {
        public frmEnumerations()
        {
            InitializeComponent();
        }

        enum DisplayType
        {
            ToTextBox,
            ToLabel,
            ToMessageBox
        }

        void DisplayText(string ShowText, DisplayType ShowWhere)
        {
            switch (ShowWhere)
            {
                case DisplayType.ToTextBox:
                    txtOutput1.Text = ShowText;
                    break;
                case DisplayType.ToLabel:
                    lblOutput2.Text = ShowText;
                    break;
                case DisplayType.ToMessageBox:
                    MessageBox.Show(ShowText, "Output 3");
                    break;
            }
        }

        private void btnTextBox_Click(object sender, EventArgs e)
        {
            DisplayText(txtDisplay.Text, DisplayType.ToTextBox);
        }

        private void btnLabel_Click(object sender, EventArgs e)
        {
            DisplayText(txtDisplay.Text, DisplayType.ToLabel);
        }

        private void btnMessage_Click(object sender, EventArgs e)
        {
            DisplayText(txtDisplay.Text, DisplayType.ToMessageBox);
        }
    }
}
